﻿using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;

namespace Marmat.Forms
{
    public partial class TopicBarPage
    {
        /* TODO ERROR: Skipped RegionDirectiveTrivia */
        internal TopicBar _TopicBar;

        [Browsable(false)]
        public TopicBar TopicBar
        {
            get
            {
                return this._TopicBar;
            }
        }

        [Description("获取或设置项的名称")]
        [RefreshProperties(RefreshProperties.All)]
        public string Name
        {
            get
            {
                return this.m_Name;
            }

            set
            {
                this.m_Name = value;
            }
        }

        internal string m_Name;
        private string _Text;
        /// <summary>
    /// 
    /// </summary>
        [Description("获取或设置项的文本")]
        public string Text
        {
            get
            {
                if (this._Text is null)
                {
                    return this.Name;
                }

                return this._Text;
            }

            set
            {
                this._Text = value;
                this.Method_Invalidate();
            }
        }

        private Image _Image;
        internal Image _EnabledImage;
        /// <summary> Item 显示的图标</summary>
        [DefaultValue(null)]
        [Description("Page 显示的图标")]
        [MergableProperty(true)]
        [Localizable(true)]
        [Editor(typeof(ImageEditor), typeof(UITypeEditor))]
        public Image Image
        {
            get
            {
                return this._Image;
            }

            set
            {
                this._Image = value;
                // If value IsNot Nothing Then
                // Me._EnabledImage = value.Clone
                // Windows.Forms.ControlPaint.DrawImageDisabled(Graphics.FromImage(Me._EnabledImage), Me._EnabledImage, 0, 0, Color.Transparent)
                // End If
                // Me.Method_Invalidate()
            }
        }

        private TopicBarItemCollection _Items;
        /// <summary>
    /// 返回Items集合
    /// </summary>
        [Browsable(false)]
        [EditorBrowsable(EditorBrowsableState.Always)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public TopicBarItemCollection Items
        {
            get
            {
                if (this._Items is null)
                {
                    this._Items = new TopicBarItemCollection(this);
                }

                return this._Items;
            }
        }

        private object _Tag = null;
        /// <summary> 获取或设置包含有关控件的数据的对象。  </summary>
        [Browsable(false)]
        [DefaultValue(null)]
        [Description("获取或设置包含有关控件的数据的对象")]
        [MergableProperty(true)]
        public object Tag
        {
            get
            {
                return this._Tag;
            }

            set
            {
                this._Tag = value;
            }
        }

        private bool _Visible = true;
        /// <summary>
    /// 返回或设置是否显示
    /// </summary>
        [DefaultValue(true)]
        public bool Visible
        {
            get
            {
                return this._Visible;
            }

            set
            {
                this._Visible = value;
                if (this.TopicBar is object)
                {
                    this.TopicBar.Invalidate();
                }
            }
        }

        private bool _Enabled = false;
        /// <summary> 当前 Item 是否可用 </summary>
        [DefaultValue(false)]
        [Description("当前 Item 是否可用")]
        [MergableProperty(true)]
        public bool Enabled
        {
            get
            {
                return this._Enabled;
            }

            set
            {
                this._Enabled = value;
                this.Method_Invalidate();
            }
        }

        /// <summary>
    /// 返回或设置是否允许折叠NavigatePage。
    /// </summary>
    /// <value></value>
    /// <returns></returns>
    /// <remarks></remarks>
        [DefaultValue(true)]
        [Description("返回或设置是否允许折叠NavigatePage。")]
        public bool AllowFold
        {
            get
            {
                return this.m_AllowFold;
            }

            set
            {
                this.m_AllowFold = value;
            }
        }

        private bool m_AllowFold = true;
        private bool _ExpandPage = false;
        /// <summary>
    /// 返回或设置是否展开NavigatePage
    /// </summary>
        [DefaultValue(false)]
        [Description("返回或设置是否展开NavigatePage")]
        public bool ExpandPage
        {
            get
            {
                return this._ExpandPage;
            }

            set
            {
                this._ExpandPage = value;
                if (this.TopicBar is object)
                {
                    this.TopicBar.Invalidate();
                }
            }
        }

        private MouseStateEnum _MouseState;
        /// <summary> Item 当前的鼠标状态</summary>
        internal MouseStateEnum MouseState
        {
            get
            {
                return this._MouseState;
            }

            set
            {
                if (this._MouseState != value)
                {
                    this._MouseState = value;
                    this.Method_Invalidate();
                }
            }
        }

        private Rectangle m_Rectangle;
        /// <summary> 当前 Page 在 NavigateBar 中的 Rectangle </summary>
        internal Rectangle Rectangle
        {
            get
            {
                return this.m_Rectangle;
            }

            set
            {
                this.m_Rectangle = value;
            }
        }
        /* TODO ERROR: Skipped EndRegionDirectiveTrivia *//* TODO ERROR: Skipped RegionDirectiveTrivia */
        private void Method_Invalidate()
        {
            if (this.TopicBar is object)
            {
                this.TopicBar.Invalidate(this.Rectangle);
            }
        }
        /* TODO ERROR: Skipped EndRegionDirectiveTrivia */
    }
}